# coding: utf-8

import requests
import json

"""
post请求提交的key是有时效性的，
超过一段时间，去到detail页时，post请求提交的data中的key就没有用了。
"""
if __name__ == '__main__':
    k5 = "       O3Jp+htwDSHDmQP5qCmMUFgK87C+u1YW" #1个空格
    "       O3Jp+htwDSHDmQP5qCmMUHd0ma1M/yBA" #2个空格
    "       O3Jp+htwDSHDmQP5qCmMUPP1ngPLPFlK" #3个空格
    "       O3Jp+htwDSHDmQP5qCmMUKUN8r0K5WA4" #4个空格

    key1 = 'O3Jp+htwDSHDmQP5qCmMUAZjqLwZvZ8E'
    key2 = 'O3Jp+htwDSHDmQP5qCmMUOor+EsLwZuU'
    key3 = 'O3Jp+htwDSHDmQP5qCmMUEc9JOQuUJid'
    url = 'http://www.soupilu.com/api/Law/DirectToLaw'

    html = requests.post(url=url, data={'key': k5.strip()})
    a = json.loads(html.content)
    with open('./detail.json', 'ab') as f:
        f.write(json.dumps(a, indent=4, encoding='utf-8', ensure_ascii=False).encode('utf-8'))
        f.write('\n\n')



